home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************************************
- +
- + LEDA 2.1.1 11-15-1991
- +
- +
- + dwindow.h
- +
- +
- + Copyright (c) 1991 by Max-Planck-Institut fuer Informatik
- + Im Stadtwald, 6600 Saarbruecken, FRG
- + All rights reserved.
- +
- *******************************************************************************/
-
-
- #ifndef DWINDOWH
- #define DWINDOWH
-
- #include<LEDA/plane.h>
-
- // #include<stdio.h>
- // #include<conio.h>
- // #include<iostream.h>
- // #include<stdlib.h>
- // #include<math.h>
- // #include<ctype.h>
-
- typedef double (*draw_func_ptr) (double);
- typedef void (*redraw_func_ptr) ();
- typedef void (*mouse_action_func_ptr) (double,double);
-
-
- enum color
- { black,
- blue,
- green,
- cyan,
- red,
- magenta,
- brown,
- lightgray,
- darkgray,
- lightblue,
- lightgreen,
- lightcyan,
- lightred,
- lightmagenta,
- yellow,
- white
- };
-
- enum line_style { solid=0, dotted=1, center=2, dashed=3 };
- enum drawing_mode { src_mode=0, xor_mode=1 };
- enum line_width { norm=1, thick=3 };
- enum mouse_button { none=0, Left=1, Middle=4, Right=2 };
-
- // enum text_mode ist hier nicht moeglich
-
-
-
- class dwindow
- { // hier kommen je nach Graphikpaket (z.B.) Variablen
-
- int nw;
- line_style ls;
- line_width lw;
- drawing_mode dm;
- int mes;
-
- public:
-
- // constructor (initialization)
-
- dwindow()
- { nw=10;
- ls=solid;
- lw=norm;
- dm=src_mode;
- mes=0;
- init();
- }
-
-
- // destructor
-
- ~dwindow();
-
- void init(); // Die Funktionen werden genauso benannt
- void clear(); // wie im LEDA Manual.
-
- // ***** setting parameters
-
- line_style set_line_style(line_style s);
- line_width set_line_width(line_width w); // nur norm und thick moeglich
- int set_node_width(int w);
- drawing_mode set_mode(drawing_mode m);
-
-
- // ***** getting parameters
-
- line_width get_line_width();
- int get_node_width();
- line_style get_line_style();
- drawing_mode get_mode();
-
- double xmin(); // nur der Vollstaendigkeit halber, liefert
- double xmax(); // je nach Aufloesung die Eckkoordinaten des
- double ymin(); // Grafikschirms
- double ymax();
-
-
- // ***** drawing segments
-
- void draw_segment(double, double, double, double, color c=white);
- // void draw_segment(point, point, color c=white);
- // void draw_segment(segment, color c=white);
-
-
- // ***** drawing lines
-
- void draw_line(double, double, double, double, color c=white);
- // void draw_line(point p, point q, color c=black);
- // void draw_line(line l, color c=black);
- void draw_hline(double, color c=white);
- void draw_vline(double, color c=white);
-
-
- // ***** drawing arrows
-
- void draw_arrow(double, double, double, double, color c=white);
- // void draw_arrow(point p, point q, color c=black);
- // void draw_arrow(segment s, color c=black);
-
-
- // ***** drawing edges
-
- void draw_edge(double, double, double, double, color c=white);
- // void draw_edge(point p, point q, color c=black);
- // void draw_edge(segment s, color c=black);
-
- void draw_edge_arrow(double, double, double, double, color c=white);
- // void draw_edge_arrow(point p, point q, color c=black);
- // void draw_edge_arrow(segment s, color c=black);
-
-
- // ***** drawing points
-
- void draw_point(double x0, double y0, color c=white);
- // void draw_point(point p, color c=BLACK);
-
- // ***** drawing nodes
-
- void draw_node(double x0, double y0, color c=white);
- // void draw_node(point p, color c=white);
- void draw_filled_node(double x0, double y0, color c=white);
- // void draw_filled_nodepoint p, color c=white);
- void draw_text_node(double x0, double y0, char *s, color c=white);
- // void draw_text_node(point p, char *s, color c=white);
- void draw_int_node(double x0, double y0, int i, color c=white);
- // void draw_int_node(point p, int i, color c=white);
-
-
- // ***** drawing circles
-
- void draw_circle(double x, double y, double r, color c=white);
- // void draw_circle(point p, double r, color c=white);
- // void draw_circle(circle c, double r, color c=white);
-
- void draw_disc(double x, double y, double r, color c=white);
- // void draw_disc(point p, double r, color c=white);
- // void draw_disc(circle c, double r, color c=white);
-
-
- // ***** drawing polygons
-
- // void draw_polygon(list(point) lp, color c=white);
- // void draw_polygon(polygon P, color c=white);
- // void draw_filled_polygon(list(point) lp, color c=white);
- // void draw_filled_polygon(polygon P, color c=white);
-
-
- // ***** text
-
- void draw_text(double x, double y, char *s, color c=white);
- // void draw_text(point p, char *s, color c=white);
- void draw_ctext(double x, double y, char *s, color c=white);
- // void draw_ctext(point p, char *s, color c=white);
-
-
- // ***** drawing functions
-
- void plot_xy(double x0, double x1, draw_func_ptr f, color c=white);
- void plot_yx(double y0, double y1, draw_func_ptr f, color c=white);
-
-
- // ***** miscellaneous
-
- void copy_rect(double, double, double, double, double, double);
- void message(char*); // spaeter string
- void del_message();
-
- // ***** mouse input
-
- int read_mouse();
- int read_mouse(double&, double&);
- int read_mouse_seg(double, double, double&, double&);
- // int read_mouse(real&, real&);
- // int read_mouse_seg(double, double, real&, real&);
- int read_mouse_rect(double, double, double&, double&);
- int read_mouse_circle(double, double, double&, double&);
- // int read_mouse_rect(double, double, real&, real&);
- // int read_mouse_circle(double, double, real&, real&);
- int read_mouse_action(mouse_action_func_ptr, double&, double&);
- // int read_mouse_action(mouse_action_func_ptr, real&, real&);
-
- int confirm(char *s);
- int acknowledge(char *s);
-
- char* read_string(char*);
- double read_real(char*);
- long int read_int(char*);
-
-
- // ***** overloaded read and draw functions
-
- // kommt alles spaeter
-
- // ***** input operators
-
- // dwindow& operator>>(point&);
- // dwindow& operator>>(segment&);
- // dwindow& operator>>(line&);
- // dwindow& operator>>(circle&);
- // dwindow& operator>>(polygon&);
-
- // ***** output operators
-
- // dwindow& operator<<(point&);
- // dwindow& operator<<(segment&);
- // dwindow& operator<<(line&);
- // dwindow& operator<<(circle&);
- // dwindow& operator<<(polygon&);
-
-
- }; // end of class dwindow
-
- #endif
-